package com.yunpuvip.sachet.biz.service;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunpuvip.sachet.biz.entity.BalanceHistory;
import com.yunpuvip.sachet.biz.entity.Payment;
import com.yunpuvip.sachet.biz.model.params.PaymentParam;
import com.yunpuvip.sachet.biz.model.result.PaymentResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yunpuvip.sachet.modular.page.LayuiPageInfo;
import com.yunpuvip.sachet.modular.vo.rest.request.BalanceReqVo;
import com.yunpuvip.sachet.modular.vo.rest.request.PaymentReqVo;
import com.yunpuvip.sachet.modular.vo.rest.response.PaymentRspVo;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 支付账单 服务类
 * </p>
 *
 * @author wushaohong
 * @since 2019-08-10
 */
public interface PaymentService extends IService<Payment> {

    /**
     * 新增
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void add(PaymentParam param);

    /**
     * 删除
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void delete(PaymentParam param);

    /**
     * 更新
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    void update(PaymentParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    PaymentResult findBySpec(PaymentParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
    List<PaymentResult> findListBySpec(PaymentParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author wushaohong
     * @Date 2019-08-10
     */
     LayuiPageInfo findPageBySpec(PaymentParam param);


    /**
     * 判断账单账单状态是否正常
     * @param payment
     * @return
     */
     boolean isPaymentOk(Payment payment);

    /**
     * 修改订单状态
     * @param
     * @return
     */
     boolean NotifyTOUpadtePaymentAndAddBalanceRecord( Payment payment );

    /**
     *获取缴费单
     * @param orderNo
     * @return
     */
     Payment getPaymentByOrderNo(String orderNo);

    /**
     *
     * @param paymentReqVo
     * @return
     */
     Page<PaymentRspVo> getPaymentPage(PaymentReqVo paymentReqVo);
    /**
     * 将所有过期的单子变为已取消
     */
    void updateExpiredOrderAndPayment();

    /**
     * 判断用户是否首次支付
     */

    boolean isFisrtPay(Integer playerId);



}
